<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>UnitreeCameraSDK: include/StereoCameraCommon.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">UnitreeCameraSDK
   &#160;<span id="projectnumber">1.0.1</span>
   </div>
   <div id="projectbrief">unitree stereo camra apis</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">StereoCameraCommon.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_stereo_camera_common_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef __STEREO_CAMERA_COMMOM_HPP__</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define __STEREO_CAMERA_COMMOM_HPP__</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;thread&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;condition_variable&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;opencv2/opencv.hpp&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;chrono&gt;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_system_log_8hpp.html">SystemLog.hpp</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="struct_p_c_l.html">   28</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_p_c_l.html">PCL</a> {</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="struct_p_c_l.html#a07c28b7f533724d91ec4a9e461989d8c">   29</a></span>&#160;  cv::Vec3f <a class="code" href="struct_p_c_l.html#a07c28b7f533724d91ec4a9e461989d8c">pts</a>;  </div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="struct_p_c_l.html#a6555550c790378b130273dd6ae3a2158">   30</a></span>&#160;  cv::Vec3b <a class="code" href="struct_p_c_l.html#a6555550c790378b130273dd6ae3a2158">clr</a>;  </div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;}<a class="code" href="struct_p_c_l.html">PCLType</a>;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="class_stereo_camera.html">   38</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_stereo_camera.html">StereoCamera</a></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;{</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span>TimeFrame{</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        cv::Mat data1;                        </div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        cv::Mat data2;                        </div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        std::chrono::microseconds timeStamp;  </div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    }TimeFrameType;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    </div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordtype">int</span> m_radius = 0;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordtype">int</span> m_algorithm = 0;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordtype">int</span> m_logLevel = 1;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keywordtype">int</span> m_deviceNode = 0;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordtype">int</span> m_posNumber = 0;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordtype">int</span> m_serialNumber = 0;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keywordtype">int</span> m_threshold = 120;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keywordtype">float</span> m_frameRate = 30.0;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keywordtype">int</span> m_ipLastSegment = 15;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    </div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="keywordtype">bool</span> m_shareMemSupport = <span class="keyword">false</span>;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="keywordtype">bool</span> m_udpH264Support = <span class="keyword">false</span>;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keywordtype">bool</span> m_isOpened = <span class="keyword">false</span>;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordtype">bool</span> m_isCompute = <span class="keyword">false</span>;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    </div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    cv::Size m_frameSize;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    cv::Size m_rectSize;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    </div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    TimeFrameType m_stampFrame, m_dispFrame;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    </div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    cv::Mat m_leftXi,m_leftRotation,m_leftIntrinsic,m_leftDistortion;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    cv::Mat m_rightXi,m_rightRotation,m_rightIntrinsic,m_rightDistortion;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    cv::Mat m_translation;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;       </div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    cv::Mat m_kfe, m_fmap[2], m_lmap[2][2], m_lagerFmap[2];</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    </div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <a class="code" href="class_system_log.html">SystemLog</a> *m_log = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    std::string m_logName = <span class="stringliteral">&quot;StereoCamera&quot;</span>;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    </div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    std::mutex m_capLock, m_dispLock;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    std::condition_variable m_capTrigger, m_dispTrigger;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    </div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    cv::VideoCapture *m_videoCap = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    </div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    std::thread *m_capWorker = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    std::thread *m_dispWorker = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    </div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <a class="code" href="class_stereo_camera.html">StereoCamera</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <a class="code" href="class_stereo_camera.html">StereoCamera</a>(std::string fileName);</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <a class="code" href="class_stereo_camera.html">StereoCamera</a>(<span class="keywordtype">int</span> deviceNode);</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="class_stereo_camera.html">StereoCamera</a>();</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    </div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isOpened(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setLogLevel(<span class="keywordtype">int</span> level);</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setPosNumber(<span class="keywordtype">int</span> posNumber);</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setSerialNumber(<span class="keywordtype">int</span> serialNumber);</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setRawFrameRate(<span class="keywordtype">int</span> frameRate);</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setRawFrameSize(cv::Size frameSize);</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setRectFrameSize(cv::Size frameSize);</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> setCalibParams(std::vector&lt;cv::Mat&gt; paramsArray, <span class="keywordtype">bool</span> flag = <span class="keyword">false</span>);</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> getLogLevel(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> getDeviceNode(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> getPosNumber(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> getSerialNumber(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">float</span> getRawFrameRate(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    <span class="keyword">virtual</span> cv::Size getRawFrameSize(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getRawFrame(cv::Mat &amp;frame, std::chrono::microseconds &amp;timeStamp);</div><div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getStereoFrame(cv::Mat &amp;left, cv::Mat &amp;right, std::chrono::microseconds &amp;timeStamp);</div><div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getDepthFrame(cv::Mat&amp; depth, <span class="keywordtype">bool</span> color, std::chrono::microseconds &amp;timeStamp);</div><div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getPointCloud(std::vector&lt;cv::Vec3f&gt; &amp;pcl, std::chrono::microseconds &amp;timeStamp);</div><div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getPointCloud(std::vector&lt;PCLType&gt;&amp; pcl, std::chrono::microseconds&amp; timeStamp);</div><div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getCalibParams(std::vector&lt;cv::Mat&gt; &amp;paramsArray, <span class="keywordtype">bool</span> flag = <span class="keyword">false</span>);</div><div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getRectStereoFrame(cv::Mat &amp;left, cv::Mat &amp;right, cv::Mat &amp;feim);</div><div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getRectStereoFrame(cv::Mat &amp;left, cv::Mat &amp;right, cv::Mat &amp;feim, std::chrono::microseconds &amp;timeStamp);</div><div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> loadConfig(std::string fileName);</div><div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> loadCalibParams(std::string fileName);</div><div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> saveConfig(std::string fileName = <span class="stringliteral">&quot;stereo_camera_config.yaml&quot;</span>);</div><div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> saveCalibParams(std::string fileName = <span class="stringliteral">&quot;stereo_camera_calibparams.yaml&quot;</span>);</div><div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> startCapture(<span class="keywordtype">bool</span> udpFlag = <span class="keyword">false</span>, <span class="keywordtype">bool</span> shmFlag = <span class="keyword">false</span>);</div><div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> startStereoCompute(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> stopStereoCompute(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> stopCapture(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;};</div><div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;</div><div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;<span class="preprocessor">#endif //__STEREO_CAMERA_COMMOM_HPP__</span></div><div class="ttc" id="_system_log_8hpp_html"><div class="ttname"><a href="_system_log_8hpp.html">SystemLog.hpp</a></div><div class="ttdoc">This file is part of UnitreeCameraSDK, which declare the APIs of log system. </div></div>
<div class="ttc" id="class_stereo_camera_html"><div class="ttname"><a href="class_stereo_camera.html">StereoCamera</a></div><div class="ttdoc">this class integrate camera control and stereo vision algorithm </div><div class="ttdef"><b>Definition:</b> StereoCameraCommon.hpp:38</div></div>
<div class="ttc" id="struct_p_c_l_html_a07c28b7f533724d91ec4a9e461989d8c"><div class="ttname"><a href="struct_p_c_l.html#a07c28b7f533724d91ec4a9e461989d8c">PCL::pts</a></div><div class="ttdeci">cv::Vec3f pts</div><div class="ttdoc">points coordinates (x, y, z) </div><div class="ttdef"><b>Definition:</b> StereoCameraCommon.hpp:29</div></div>
<div class="ttc" id="struct_p_c_l_html_a6555550c790378b130273dd6ae3a2158"><div class="ttname"><a href="struct_p_c_l.html#a6555550c790378b130273dd6ae3a2158">PCL::clr</a></div><div class="ttdeci">cv::Vec3b clr</div><div class="ttdoc">points color (b, g, r) </div><div class="ttdef"><b>Definition:</b> StereoCameraCommon.hpp:30</div></div>
<div class="ttc" id="class_system_log_html"><div class="ttname"><a href="class_system_log.html">SystemLog</a></div><div class="ttdef"><b>Definition:</b> SystemLog.hpp:18</div></div>
<div class="ttc" id="struct_p_c_l_html"><div class="ttname"><a href="struct_p_c_l.html">PCL</a></div><div class="ttdoc">this struct is used for RGB point cloud capture and display </div><div class="ttdef"><b>Definition:</b> StereoCameraCommon.hpp:28</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
